package Backup.Library;

// <editor-fold defaultstate="collapsed" desc="import">
import java.io.File;
// </editor-fold>

/**
 * Helper class provides static functions for paths operations
 * @author Piotr Poradzisz
 */
public class PathHelper {
    
    // <editor-fold defaultstate="collapsed" desc="public methods">
    
    /**
     * Combines multi paths into one path
     * @param paths Number of coma speparated strings representing paths to combine
     * @return Combined path
     */
    public static String combinePaths(String ... paths)
    {
        if ( paths.length == 0)
        {
            throw new IllegalArgumentException("paths");
        }

        File Combined = new File(paths[0]);

        int i = 1;
        while ( i < paths.length)
        {
            Combined = new File(Combined, paths[i]);
            ++i;
        }

        return Combined.getPath();
    }
    // </editor-fold>
    
}
